package com.jingtai.platform.controller.shop;

import com.jingtai.core.entity.BaseEntity;
import com.jingtai.core.entity.shop.MerchantsGoodsDetail;
import com.jingtai.platform.service.shop.MerchantsGoodsDetailService;
import com.jingtai.platform.util.ResultUtil;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.jingtai.validate.swagger.CApiParam;

/**
 * 商户商品详情表
 *
 * @author sunlaiqian
 * @date 2020-12-02 18:31:32
 */
@Validated
@RestController
@RequestMapping("/platform/merchantsgoodsdetail")
@Api(tags = "商户商品详情表")
public class MerchantsGoodsDetailController{

    @Autowired
    private MerchantsGoodsDetailService merchantsGoodsDetailService;


    @ApiOperation("商户商品详情表列表查询")
    @GetMapping("/list")
    public ResultUtil aopMerchantsGoodsDetailList(@CApiParam(name = "page",value = "页数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("page") Integer page,
                              @CApiParam(name = "limit",value = "每页个数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("limit") Integer limit,
                              @CApiParam(name = "conditions",value = "查询条件",required = false) @RequestParam("conditions") String conditions){
        return merchantsGoodsDetailService.MerchantsGoodsDetaillist(page, limit, conditions);
    }


    @ApiOperation("根据ID查询merchantsGoodsDetail实体")
    @GetMapping("/getMerchantsGoodsDetailById")
    public ResultUtil GetMerchantsGoodsDetailById(@CApiParam(name = "id",value = "merchantsGoodsDetail实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return merchantsGoodsDetailService.getMerchantsGoodsDetailById(id);
    }

    @ApiOperation("根据商品编码查询merchantsGoodsDetail实体")
    @GetMapping("/getMerchantsGoodsDetailByGoodsCode")
    public ResultUtil GetMerchantsGoodsDetailByGoodsCode(@CApiParam(name = "goodsCode",value = "merchantsGoodsDetail实体商品编码",required = true,cNotEmpty = true) @RequestParam("goodsCode") String goodsCode){
        return merchantsGoodsDetailService.getMerchantsGoodsDetailByGoodsCode(goodsCode);
    }

    @ApiOperation("新增merchantsGoodsDetail实体")
    @PostMapping("/add")
    @ApiOperationSupport(ignoreParameters = {"merchantsGoodsDetail.id","merchantsGoodsDetail.createTime","merchantsGoodsDetail.updateTime","merchantsGoodsDetail.deleteFlag"})
    public ResultUtil aopAddMerchantsGoodsDetail(@RequestBody @Validated({BaseEntity.Create.class}) MerchantsGoodsDetail merchantsGoodsDetail){
        return merchantsGoodsDetailService.addMerchantsGoodsDetail(merchantsGoodsDetail);
    }

    @ApiOperation("编辑merchantsGoodsDetail实体")
    @PostMapping("/edit")
    @ApiOperationSupport(ignoreParameters = {"merchantsGoodsDetail.createTime","merchantsGoodsDetail.updateTime","merchantsGoodsDetail.deleteFlag"})
    public ResultUtil aopEditMerchantsGoodsDetail(@RequestBody @Validated({BaseEntity.Update.class}) MerchantsGoodsDetail merchantsGoodsDetail){
        return merchantsGoodsDetailService.editMerchantsGoodsDetail(merchantsGoodsDetail);
    }

    @ApiOperation("根据ID删除merchantsGoodsDetail实体")
    @GetMapping("/delMerchantsGoodsDetailById")
    public ResultUtil aopDelMerchantsGoodsDetailById(@CApiParam(name = "id",value = "merchantsGoodsDetail实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return merchantsGoodsDetailService.delMerchantsGoodsDetailById(id);
    }

}






